package com.minew.beaconset.beaconset.comparator;

import com.minew.beaconset.bean.MinewBeaconTimes;

import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;

/**
 * Map 排序
 */
public class MapValueComparator implements Comparator<Float> {

    Map<Float, MinewBeaconTimes> base;

    public MapValueComparator(Map<Float, MinewBeaconTimes> base) {
        this.base = base;
    }

    public int compare(Float a, Float b) {
        if (base.get(a).getTimes() >= base.get(b).getTimes()) {
            return -1;
        } else {
            return 1;
        }
    }
}
